package com.bnz.controller;

import com.bnz.entity.Dept;
import com.bnz.entity.R;
import com.bnz.service.IDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wangye
 * @since 2023-03-21
 */
@RestController
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    private IDeptService deptService;
    // 查询所有部门
    @RequestMapping("/list")
    public R findAll(){
        List<Dept> depts = deptService.list();
        return R.ok().put("list",depts);
    }
}
